/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package carcassonne.gui;

import java.awt.Graphics;
import java.awt.Image;
import javax.swing.JPanel;

/**
 *
 * @author Jeff
 */
public class ImagePanel extends JPanel {

	private Image image;
	
	public ImagePanel(Image img) {
		this.setImage(img);
	}

	public void paintComponent(Graphics g) {
		super.paintComponent(g);

		//Draw image to fill panel   
		g.drawImage(this.getImage(), 0, 0, this.getWidth(), this.getHeight(), 0, 0, this.getImage().getWidth(this), this.getImage().getHeight(this), this);
	}
	
	public Image getImage() {
		return image;
	}

	private void setImage(Image img) {
		this.image = img;
	}
}
